﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Induction.FinalTest
{
    public partial class CustomerDataList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
                GridViewCustomerDetail.DataSourceID = "";
                GridViewCustomerDetail.DataSource = GetCustomerDetail();
                GridViewCustomerDetail.DataBind();
            //}
        }

        protected void SearchButton_Click(object sender, EventArgs e)
        {
            var tableAdapter = new GeneralDataSetTableAdapters.CustomersCountriesTableAdapter();
            SearchRepeater.DataSource = tableAdapter.GetDataByParam("%"+SearchText.Text.ToString()+"%");
            SearchRepeater.DataBind();
        }

        public GeneralDataSet.CustomersCountriesDataTable GetCustomerDetail()
        {
            var tableAdapter = new GeneralDataSetTableAdapters.CustomersCountriesTableAdapter();
            return tableAdapter.GetData();
        }

        protected void GridViewCustomerDetail_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridViewCustomerDetail.PageIndex = e.NewPageIndex;
            GridViewCustomerDetail.DataBind();
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Response.Redirect("Index.aspx");
        }
    }
}